package view.transitions;

import java.awt.Graphics;
import java.awt.image.BufferedImage;

public class WipeUp extends Animator {

	private BufferedImage	buffer;

	public WipeUp(BufferedImage from, BufferedImage to) {
		super(from, new BufferedImage(to.getWidth(), to.getHeight(), BufferedImage.TYPE_INT_ARGB));
		this.buffer = to;
	}

	@Override
	public void animate() {
		int startPosition = this.overlay.getHeight() - this.overlay.getHeight() * this.currentFrame
				/ Animator.MAX_FRAMES;
		this.currentFrame++;
		int endPosition = this.overlay.getHeight() - this.overlay.getHeight() * this.currentFrame / Animator.MAX_FRAMES;
		Graphics g = this.overlay.getGraphics();
		g.clipRect(0, startPosition, this.overlay.getWidth(), endPosition);
		g.drawImage(this.buffer, 0, 0, null);

	}

}
